home *** CD-ROM | disk | FTP | other *** search
/ Programming Sound Cards / Programming Sound Cards.iso / sound_52 / prog.hlp < prev    next >
Text File  |  1995-01-01  |  2KB  |  138 lines

  1. RAVEL programming constructs
  2.  
  3. 1. program structure #################################
  4.  
  5. <constants>
  6. <global data>
  7. <riffs/functions>
  8. <voicelists>
  9.  
  10. 2. constants #################################
  11.  
  12. BASSDRUM = LC
  13. HOWLONG = 3 * w
  14. MAXUCHAR = 0xff
  15.  
  16. 3. global data  #################################
  17.  
  18. # 1 dim arrays
  19. uchar foof[10]
  20. int foof2[100]
  21.  
  22. # 2 dim arrays
  23. uchar foo[2][3]
  24. int foo2[3][10]
  25.  
  26. # notes
  27. notes notelist1 = {
  28.     C, q, 80,
  29.     D, q+1, 85,
  30.     E, q+2, 90,
  31. }
  32.  
  33. # initialized data, global data only
  34.  
  35. uchar glob1[18]={
  36.     C,C,E,G,G,E,E,C,C,
  37.     C,C,E,G,G,E,E,D,D
  38. }
  39. uchar twobytwo[2][2] = {
  40.     1,2,
  41.     3,4
  42. }
  43.  
  44. 4. riff form ###########################
  45.  
  46. riff wowser(vector foo, size)
  47. end
  48.  
  49. 5. voicelist form ###########################
  50.  
  51. vco melody
  52. end
  53.  
  54. 6. programming statements ###########################
  55.  
  56. # if then else forms
  57.  
  58. if ( x )
  59. end
  60.  
  61. if ( x )
  62. else
  63. end
  64.  
  65. if ( x ) 
  66. else if ( y )
  67. else
  68. end
  69.  
  70. if ( x ) 
  71. else if ( y )
  72. end
  73.  
  74. # switch - multi-way branch
  75. switch(x)
  76. case 1:
  77.     end
  78. case 2:
  79.     end
  80. case 3..10:
  81.     end
  82. default:
  83.     end
  84. end
  85.  
  86. # do forever
  87. for (;;)
  88.  
  89. end
  90.  
  91. # standard for loop
  92. for (i = 0; i < MAX; i++)
  93. end
  94.  
  95. # repeat a constant number of times
  96. do
  97. while    100
  98.  
  99. 7. function parameters ###########################
  100.  
  101. uchar buf[10]
  102.  
  103. riff printVec(vector a, size)
  104.     int i
  105.     for ( i = 0; i < size; i++)
  106.         void printf("%d ",a[i])
  107.     end
  108.     void printf("\n")
  109. end
  110.  
  111. vco doit
  112.     void printVec(&buf,10)
  113. end
  114.  
  115. 8. note structure access ####################################
  116.  
  117. # appears to be 8 by 3 but is actually 3 by 8!
  118. #
  119. notes foof = {
  120.     C, q, 80,
  121.     D, q+1, 85,
  122.     E, q+2, 90,
  123.     F, q+3, 93,
  124.     G, q+4, 97,
  125.     A, q+5, 100,
  126.     B, q+6, 105,
  127.     HC, q+7, 110 
  128. }
  129.  
  130. vco test
  131.     int col
  132.  
  133.     for ( col = 0; col < NONOTES; col++)
  134.         void printf("%d %d %d\n",foof[0][col],foof[1][col],foof[2][col])
  135.     end
  136.  
  137. end
  138.